﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using LiveCharts;
using LiveCharts.Wpf;

namespace BoKeYuanApp
{
    /// <summary>
    /// MyRecordView.xaml 的交互逻辑
    /// </summary>
    public partial class MyRecordView : Window
    {

        public SeriesCollection ScoreSeriesCollection { get; set; }
        public SeriesCollection RinkeriesCollection { get; set; }
        public MyRecordView()
        {
            InitializeComponent();

            List<int> blogs = new List<int>();
            
           

            List<int> score = new List<int>();
            List<int> ranking = new List<int>();
            using (BoKeYuanDbEntities dbEntities = new BoKeYuanDbEntities())
            {
                foreach (myRecord statistics in dbEntities.myRecord.OrderBy(i => i.recordTime))
                {
                    Console.WriteLine(statistics.recordTime + " " + statistics.ranking);
                    score.Add(statistics.score.Value);
                    ranking.Add(statistics.ranking.Value);
                }
            }
            
            

            RinkeriesCollection = new SeriesCollection
            {

                new ColumnSeries
                {
                    Values = new ChartValues<int>( ranking)

                },
                new LineSeries()
                {
                    Values = new ChartValues<int>(ranking)
                }
            };

            ScoreSeriesCollection = new SeriesCollection
            {

                new ScatterSeries() 
                {
                    Values = new ChartValues<int>(score)
                },
                new LineSeries()
                {
                    Values = new ChartValues<int>(score)
                }
            };
          
            this.DataContext = this;
        }
    }
}
